package org.dmd.wsdl.server.generated.dmw;

// Generated from: org.dmd.util.codegen.ImportManager.getFormattedImports(ImportManager.java:82)
// Called from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:442)
import java.util.ArrayList;                                            // To support getMVCopy() - (BaseDMWGenerator.java:1181)
import org.dmd.dmc.*;                                                  // If any attributes - (BaseDMWGenerator.java:1087)
import org.dmd.dmc.definitions.DmcDefinitionIF;                        // The object is a domain specific definition - (BaseDMWGenerator.java:411)
import org.dmd.dmc.types.DefinitionName;                               // Is named by - (BaseDMWGenerator.java:1062)
import org.dmd.dms.ClassDefinition;                                    // Passing derived class def up the hierarchy - (BaseDMWGenerator.java:1067)
import org.dmd.dms.generated.dmo.MetaDMSAG;                            // Required for MODREC constructor - (BaseDMWGenerator.java:1072)
import org.dmd.dms.generated.types.DmcTypeModifierMV;                  // Required for MODREC constructor - (BaseDMWGenerator.java:1071)
import org.dmd.wsdl.server.extended.XsComplexType;                     // Required for getModificationRecorder() - (BaseDMWGenerator.java:1076)
import org.dmd.wsdl.server.extended.XsElement;                         // Is reference type - (BaseDMWGenerator.java:1107)
import org.dmd.wsdl.server.extended.XsType;                            // Derived class - (BaseDMWGenerator.java:1248)
import org.dmd.wsdl.server.generated.dmw.XsElementIterableDMW;         // For multi-valued XsElement - (BaseDMWGenerator.java:1709)
import org.dmd.wsdl.shared.generated.dmo.DmwsdlDMSAG;                  // Attribute elements from the dmwsdl schema - (BaseDMWGenerator.java:897)
import org.dmd.wsdl.shared.generated.dmo.XsComplexTypeDMO;             // Class not auxiliary or abstract - (BaseDMWGenerator.java:1252)
import org.dmd.wsdl.shared.generated.dmo.XsElementDMO;                 // For multi-valued adds of XsElement - (BaseDMWGenerator.java:1767)
import org.dmd.wsdl.shared.generated.types.WsdlModuleREF;              // Required to access defined in module name - (DMWGenerator.java:180)



/**
 * A complex type composed of other, previously defined elements.
 * <P>
 * Generated from the dmwsdl schema at version unknown
 * <P>
 * This code was auto-generated by the dmggenerator utility and shouldn't be alterred manually!
 * Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:479)
 */
abstract public class XsComplexTypeDMW extends XsType implements DmcDefinitionIF, DmcNamedObjectIF {

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:558)
    public XsComplexTypeDMW() {
        super(new XsComplexTypeDMO(), org.dmd.wsdl.server.generated.DmwsdlSchemaAG._XsComplexType);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:564)
    public XsComplexTypeDMW(DmcTypeModifierMV mods) {
        super(new XsComplexTypeDMO(mods), org.dmd.wsdl.server.generated.DmwsdlSchemaAG._XsComplexType);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:606)
    public XsComplexType getModificationRecorder(){
        XsComplexType rc = new XsComplexType();
        rc.setName(getName());
        rc.setModifier(new DmcTypeModifierMV(MetaDMSAG.__modify));
        return(rc);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:627)
    public XsComplexTypeDMW(XsComplexTypeDMO obj) {
        super(obj, org.dmd.wsdl.server.generated.DmwsdlSchemaAG._XsComplexType);
    }

    public XsComplexType cloneIt() {
        XsComplexType rc = new XsComplexType();
        rc.setDmcObject(getDMO().cloneIt());
        return(rc);
    }

    public XsComplexTypeDMO getDMO() {
        return((XsComplexTypeDMO) core);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:642)
    protected XsComplexTypeDMW(XsComplexTypeDMO obj, ClassDefinition cd) {
        super(obj,cd);
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.getAccessFunctions(BaseDMWGenerator.java:1297)
    public DefinitionName getObjectName(){
        return(((XsComplexTypeDMO) core).getName());
    }

    public int hashCode(){
        return(getObjectName().hashCode());
    }

    public DmcAttribute<?> getObjectNameAttribute(){
        return(((XsComplexTypeDMO) core).getObjectNameAttribute());
    }

    public boolean equals(Object obj){
        if (obj instanceof XsComplexTypeDMW){
            return( getObjectName().equals( ((XsComplexTypeDMW) obj).getObjectName()) );
        }
        return(false);
    }

    /**
     * @return The number of XsElement items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1671)
    public int getElementsSize(){
        return(((XsComplexTypeDMO) core).getElementsSize());
    }

    /**
     * @return true if there are no XsElementDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1679)
    public boolean getElementsIsEmpty(){
        if (((XsComplexTypeDMO) core).getElementsSize() == 0)
            return(true);
        return(false);
    }

    /**
     * @return true if there are any XsElementDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1689)
    public boolean getElementsHasValue(){
        if (((XsComplexTypeDMO) core).getElementsSize() == 0)
            return(false);
        return(true);
    }

    /**
     * @return An Iterator of XsElementDMO objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1716)
    public XsElementIterableDMW getElementsIterable(){
        DmcAttribute<?> attr = core.get(DmwsdlDMSAG.__elements);
        if (attr == null)
            return(XsElementIterableDMW.emptyList);
        
        return(new XsElementIterableDMW(((XsComplexTypeDMO) core).getElements()));
    }

    /**
     * Adds another elements value.
     * @param value A value compatible with XsElement
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1773)
    public DmcAttribute<?> addElements(XsElement value){
        DmcAttribute<?> attr = ((XsComplexTypeDMO) core).addElements(((XsElementDMO)value.getDmcObject()));
        return(attr);
    }

    /**
     * Deletes a elements value.
     * @param value The XsElement to be deleted from set of attribute values.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1823)
    public void delElements(XsElement value){
        ((XsComplexTypeDMO) core).delElements(value.getDMO());
    }

    /**
     * @return A COPY of the collection of XsElement objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1887)
    public ArrayList<XsElement> getElementsCopy(){
        DmcAttribute<?> attr = ((XsComplexTypeDMO) core).get(DmwsdlDMSAG.__elements);
        if (attr == null)
            return(new ArrayList<XsElement>());
        
        ArrayList<XsElement> rc = new ArrayList<XsElement>(attr.getMVSize());
        
        XsElementIterableDMW it = getElementsIterable();
        while(it.hasNext()){
            rc.add(it.next());
        }
        
        return(rc);
    }

    /**
     * Removes the elements attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2292)
    public void remElements(){
        ((XsComplexTypeDMO) core).remElements();
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public DefinitionName getName(){
        return(((XsComplexTypeDMO) core).getName());
    }

    /**
     * Sets name to the specified value.
     * @param value A value compatible with DmcTypeDefinitionName
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setName(Object value) throws DmcValueException {
        ((XsComplexTypeDMO) core).setName(value);
    }

    /**
     * Sets name to the specified value.
     * @param value DefinitionName
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setName(DefinitionName value){
        ((XsComplexTypeDMO) core).setName(value);
    }

    /**
     * Removes the name attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remName(){
        ((XsComplexTypeDMO) core).remName();
    }

    // Generated from: org.dmd.dmg.generators.DMWGenerator.dumpAdditionalWrapperFunctions(DMWGenerator.java:221)
    /**
     * This method indicates the name of the module from which this definition was loaded.
     */
    @Override
    public String getNameOfModuleWhereThisCameFrom(){
        WsdlModuleREF ref = ((XsComplexTypeDMO) core).getDefinedInWsdlModule();
        return(ref.getName().getNameString());
    }


}
